#include "Data.h"
void Date::init(void){                        
   struct tm *ptr;     
   time_t sec;         
   time(&sec);         
   ptr = localtime(&sec); 
   
   month = (short) ptr->tm_mon + 1;
   day   = (short) ptr->tm_mday;
   year  = (short) ptr->tm_year + 1900;
} 

void Date::init( int m, int d, int y)
{
   month = (short) m;
   day   = (short) d;
   year  = (short) y;
}

void Date::print(void)
{
   cout << day << '-' << month << '-' << year
        << endl;
}
short Date::getDay()
{
   return this->day;
}
short Date::getMonth()
{
   return this->month;
}
short Date::getYear()
{
   return this->year;
}
bool Date::operator<(Date d)
{
   short d1,m1,y1,d2,m2,y2;
   d1=this->getDay();
   m1=this->getMonth();
   y1=this->getYear();
   d2=d.getDay();
   m2=d.getMonth();
   y2=d.getYear();
   if(y2<=y1) return false;
   else if((m2<=m1)&&(y1==y2)) return false;
   else if((m2=m1)&&(y1==y2)&&(d2<=d1)) return false;
   return true;
}
bool Date::operator>(Date d)
{
   short d1,m1,y1,d2,m2,y2;
   d1=this->getDay();
   m1=this->getMonth();
   y1=this->getYear();
   d2=d.getDay();
   m2=d.getMonth();
   y2=d.getYear();
   if(y2>=y1) return false;
   else if((m2>=m1)&&(y1==y2)) return false;
   else if((m2=m1)&&(y1==y2)&&(d2>=d1)) return false;
   return true;
}

